<template>
	<div class="customer vipCard">

		<el-row style="margin-top: 15px;padding: 20px 0;">
			<el-col :span="24">
				<el-button @click="goBack()" type="primary">返回</el-button>
				
				<el-tabs v-model="activeName" @tab-click="handleClick" style="margin-top: 20px;">
					<el-tab-pane :label="'服务商城'" name="1"></el-tab-pane>
					<el-tab-pane :label="'代金券'" name="2"></el-tab-pane>
					<el-tab-pane :label="'会员卡'" name="3"></el-tab-pane>
				</el-tabs>
			</el-col>
		</el-row>

		<el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="100px" v-show="activeName==1">
			<el-form-item label="按套餐名称:">
				<el-input v-model="formInline.voucherName" style="width: 150px;" :maxlength="50"></el-input>
			</el-form-item>
			<el-form-item label="按状态：">
				<el-select v-model="formInline.voucherStat" style="width: 120px;">
					<el-option label="全部" value=""></el-option>
					<el-option :label="item.text" :value="item.value" v-for="item in statList"></el-option>
				</el-select>
			</el-form-item>
			<el-button type="primary" @click="fetchData(1)">查询</el-button>

		</el-form>
		<el-table :data="pageInfo.dtos" v-loading="table_loading" element-table_loading-text="加载中" stripe @sort-change='order'
		 v-show="activeName==1" style="width: 100%">
			<el-table-column type="index" width="80" label="序号">
			</el-table-column>
			<el-table-column label="封面">
				<template scope="scope">
					<img class="avatar" :src="scope.row.voucherCover" style="width: 55px;height: 55px;border-radius: 0;">
				</template>
			</el-table-column>
			<el-table-column prop="voucherName" label="套餐名称">
			</el-table-column>
			<el-table-column sortable='custom' prop="voucher_Amt" label="价格">
				<template scope="scope">
					<span>{{ scope.row.voucherAmt }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="voucherSunNum" label="销量">
			</el-table-column>
			<el-table-column prop="voucherNum" label="库存">
			</el-table-column>
			<el-table-column label="有效期">
				<template scope="scope">
					<span>{{ scope.row.voucherStartTime }}至{{ scope.row.voucherEndTime }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="normalState" label="状态">
				<template scope="scope">
					<span>{{statList[scope.row.voucherStat].text}}</span>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="140">
				<template scope="scope">
					<el-button type="primary" size="small" @click="$router.push('/merchant/combo_detail/'+scope.row.voucherId)">编辑</el-button>
					<el-button type="danger" size="small" v-if="scope.row.voucherStat==1" @click="handleDelete(scope.row,'禁用')">禁用
					</el-button>
					<el-button type="success" size="small" v-else @click="handleDelete(scope.row,'启用')">启用
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="paginate" v-show="activeName==1">
			<el-pagination @current-change="handleCurrentChange" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize"
			 layout="total, prev, pager, next, jumper" :total="pageInfo.count">
			</el-pagination>
		</div>

		<!--代金券table-->
		<el-form :inline="true" :model="formInline2" class="demo-form-inline" label-width="120px" v-show="activeName==2">
			<el-form-item label="按代金券名称:">
				<el-input v-model="formInline2.voucherName" style="width: 150px;" :maxlength="50"></el-input>
			</el-form-item>
			<el-form-item label="按状态：">
				<el-select v-model="formInline.voucherStat" style="width: 120px;">
					<el-option label="全部" value=""></el-option>
					<el-option :label="item.text" :value="item.value" v-for="item in statList"></el-option>
				</el-select>
			</el-form-item>
			<el-button type="primary" @click="fetchData2(1)">查询</el-button>

		</el-form>
		<el-table :data="pageInfo2.dtos" v-loading="table_loading" element-table_loading-text="加载中" stripe @sort-change='order2'
		 v-show="activeName==2" style="width: 100%">
			<el-table-column type="index" width="80" label="序号">
			</el-table-column>
			<el-table-column label="封面">
				<template scope="scope">
					<img class="avatar" :src="scope.row.voucherCover" style="width: 55px;height: 55px;border-radius: 0;">
				</template>
			</el-table-column>
			<el-table-column prop="voucherName" label="代金券名称">
			</el-table-column>
			<el-table-column sortable='custom' prop="voucher_Amt" label="价格">
				<template scope="scope">
					<span>{{ scope.row.voucherAmt }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="voucherSunNum" label="销量">
			</el-table-column>
			<el-table-column prop="voucherNum" label="库存">
			</el-table-column>
			<el-table-column sortable='custom' label="有效期">
				<template scope="scope">
					<span>{{ scope.row.voucherStartTime }}-{{ scope.row.voucherEndTime }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="normalState" label="状态">
				<template scope="scope">
					<span>{{statList[scope.row.voucherStat].text}}</span>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="140">
				<template scope="scope">
					<el-button type="primary" size="small" @click="voucherDetail(scope.row.voucherId)">查看</el-button>
					<el-button type="danger" size="small" v-if="scope.row.voucherStat==1" @click="handleDelete2(scope.row,'禁用')">禁用
					</el-button>
					<el-button type="success" size="small" v-else @click="handleDelete2(scope.row,'启用')">启用
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="paginate" v-show="activeName==2">
			<el-pagination @current-change="handleCurrentChange" :current-page="pageInfo2.pageNum" :page-size="pageInfo2.pageSize"
			 layout="total, prev, pager, next, jumper" :total="pageInfo2.count">
			</el-pagination>
		</div>

		<el-row style="position: relative;" v-show="activeName==3">
			<!-- 			<el-col :span="24">
				
						<el-button type="primary" @click="$router.push('/merchant/merchant_list')">返回
						</el-button>
					</el-col> -->
			<el-form :inline="true" :model="formInline4" class="demo-form-inline" label-width="120px">
				<el-form-item label="会员卡状态：">
					<el-select v-model="formInline4.voucherStat" style="width: 120px;">
						<el-option label="全部" value=""></el-option>
						<el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
					</el-select>
				</el-form-item>
				<el-button type="primary" @click="fetchData4(1)">查询</el-button>
				<el-button type="primary" @click="findCardList()">会员卡名单</el-button>
				<!-- <el-button type="primary" @click="findPayCardList()">会员卡购买记录</el-button> -->
			</el-form>

		</el-row>

		<el-table :data="pageInfo4.lists" v-loading="table_loading" element-table_loading-text="加载中" stripe v-show="activeName==3"
		 style="width: 100%">
			<el-table-column type="index" width="80" label="序号">
			</el-table-column>

			<el-table-column prop="voucherName" label="卡片名称">
			</el-table-column>
			<el-table-column label="会员卡封面">
				<template scope="scope">
					<img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
				</template>
			</el-table-column>
			<el-table-column prop="balance" label="卡片面值(元)">
			</el-table-column>
			<el-table-column prop="voucherAmt" label="卡片售价(元)">
			</el-table-column>
			<el-table-column prop="voucherNum" label="库存数量">
			</el-table-column>
			<el-table-column prop="voucherSunNum" label="销量">
			</el-table-column>
			<el-table-column label="补贴比例">
				<template scope="scope">
					<span>{{ scope.row.rate*100 }}%</span>
				</template>
			</el-table-column>

			<el-table-column prop="normalState" label="状态">
				<template scope="scope">
					<span>{{vipCardList[scope.row.voucherStat].text}}</span>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="140">
				<template scope="scope">
					<el-button type="primary" size="small" @click="showCardDiog(scope.row)">查看</el-button>
					<el-button type="danger" size="small" v-if="scope.row.voucherStat==1" @click="handleDelete3(scope.row,'下架')">下架
					</el-button>
					<el-button type="success" size="small" v-else @click="handleDelete3(scope.row,'上架')">上架
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="paginate" v-show="activeName==3">
			<el-pagination @current-change="handleCurrentChange" :current-page="pageInfo4.pageNum" :page-size="pageInfo4.pageSize"
			 layout="total, prev, pager, next, jumper" :total="pageInfo4.count">
			</el-pagination>
		</div>

		<div>

			<!-- 查看会员卡 -->
			<el-dialog title="查看会员卡" :visible.sync="dialogFindVipVisible" :before-close="handleClose" width="30%" center="true">
				<el-tabs v-model="activeCardName" style="margin-top: 20px;">
					<el-tab-pane :label="'会员卡信息'" name="1"></el-tab-pane>
					<el-tab-pane :label="'其他信息'" name="2"></el-tab-pane>
				</el-tabs>
				<div style="padding: 0 40px 0 20px;">
					<el-form :model="formInlineCard" class="demo-form-inline" label-width="120px" v-show="activeCardName==1">
						<el-form-item label="会员卡名称：">
							<el-input v-model="formInlineCard.voucherName"></el-input>
						</el-form-item>
						<el-form-item label="会员卡封面：">
							<div>
								<we-ui-uploads :images="formInlineCard.voucherCover" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
							</div>
						</el-form-item>
						<el-form-item label="会员卡logo：">
							<div>
								<we-ui-uploads :images="formInlineCard.logo" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
							</div>
						</el-form-item>
						<el-form-item label="卡片面值：">
							<el-input v-model="formInlineCard.balance"></el-input>
						</el-form-item>
						<el-form-item label="卡片售价：">
							<el-input v-model="formInlineCard.voucherAmt"></el-input>
						</el-form-item>
						<el-form-item label="有效日期：">
							<el-input v-model="endDaTE" readonly></el-input>
						</el-form-item>
						<el-form-item label="库存数量：">
							<el-input v-model="formInlineCard.voucherNum"></el-input>
						</el-form-item>
						<el-form-item label="特权说明：">
							<el-input v-model="formInlineCard.voucherRemark" :maxlength="120" type="textarea" :rows="3"></el-input>
						</el-form-item>
						<el-form-item label="使用须知：">
							<el-input v-model="formInlineCard.voucherUseRule" :maxlength="120" type="textarea" :rows="3"></el-input>
						</el-form-item>
					</el-form>

					<el-form :model="formInlineCard" class="demo-form-inline" label-width="120px" v-show="activeCardName==2">
						<el-form-item label="创建时间：">
							<el-input v-model="formInlineCard.creTime" readonly></el-input>
						</el-form-item>
						<el-form-item label="销量：">
							<el-input v-model="formInlineCard.voucherSunNum" readonly></el-input>
						</el-form-item>
						<el-form-item label="会员卡状态：">
							<el-select v-model="formInlineCard.voucherStat" style="width: 192px;">
								<el-option label="全部" value=""></el-option>
								<el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item label="补贴比例：">
							<el-select v-model="formInlineCard.rate" style="width: 192px;margin-right: 30px;">
								<el-option :label="item.text" :value="item.value" v-for="item in scalePublicData"></el-option>
							</el-select>
						</el-form-item>
					</el-form>
				</div>
				<span slot="footer" class="dialog-footer">
					<el-button type="primary" @click="cardSubmit()">确 定</el-button>
					<el-button @click="dialogFindVipVisible = false">取 消</el-button>
				</span>
			</el-dialog>


		</div>

		<div class="cardDialeg">
			<el-dialog title="会员卡名单" :visible.sync="dialogVisibleAll" :before-close="handleClose" center="true">
				<div style="padding: 0 20px;">
					<el-table :data="pageInfo5.dtos" v-loading="tableCard_loading" element-table_loading-text="加载中" style="width: 100%">
						<el-table-column label="用户Id" prop="userId">
						</el-table-column>
						<el-table-column prop="name" label="用户名">
						</el-table-column>
						<el-table-column prop="phone" label="手机号">
						</el-table-column>
						<el-table-column prop="voucherId" label="会员卡号">
						</el-table-column>
						<el-table-column prop="voucherName" label="会员卡名称">
						</el-table-column>
						<el-table-column prop="userName" label="会员卡绑定姓名">
						</el-table-column>
						<el-table-column prop='userPhone' label="会员卡绑定手机号">
						</el-table-column>
						<el-table-column prop="balance" label="会员卡余额">
						</el-table-column>
					</el-table>
					<div class="paginate">
						<el-pagination @current-change="handleCurrentChangeCard" :current-page="pageInfo5.pageNum" :page-size="pageInfo5.pageSize"
						 layout="total, prev, pager, next, jumper" :total="pageInfo5.count">
						</el-pagination>
					</div>
				</div>
			</el-dialog>
		</div>

		<!-- 会员卡购买记录 -->
		<div class="cardDialeg">
			<el-dialog title="会员卡名单" :visible.sync="dialogVisiblePayHistory" :before-close="handleClose" center="true">
				<div style="padding: 0 20px;">
					<el-table :data="pageInfoPay.dtos" v-loading="tableCard_loading" element-table_loading-text="加载中" style="width: 100%">
						<el-table-column
						        prop="voucherName"
						        label="卡片名称">
						</el-table-column>
						<el-table-column
						        label="会员卡封面">
						        <template scope="scope">
						            <img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
						        </template>
						</el-table-column>
						<el-table-column
						        prop="voucherAmt"
						        label="卡片售价(元)">
						</el-table-column>
						<el-table-column
						        prop="voucherNum"
						        label="库存数量">
						</el-table-column>
						<el-table-column
						prop="voucherSunNum"
						        label="销量">
						</el-table-column>
					</el-table>
					<div class="paginate">
						<el-pagination @current-change="handleCurrentChangePay" :current-page="pageInfoPay.pageNum" :page-size="pageInfoPay.pageSize"
						 layout="total, prev, pager, next, jumper" :total="pageInfoPay.count">
						</el-pagination>
					</div>
				</div>
			</el-dialog>
		</div>
	</div>

</template>
<style>
	.vipCard .el-tabs__item {
		font-size: 18px !important;
		color: #222222;
		font-weight: 500;
	}

	.vipCard .el-tabs__header {
		border-bottom: none;
	}

	.vipCard .el-dialog__header {
		text-align: center;
		background-color: #f4f5f6;
		padding: 20px;
	}

	.vipCard .el-dialog__body {
		padding: 0;
	}

	.vipCard .el-dialog--small {
		width: 30%;
	}

	.cardDialeg .el-dialog--small {
		width: 70%;
	}

	.vipCard .el-form-item {
		margin-bottom: 10px;
	}

	.weui-uploader__files img {
		width: 100px !important;
		height: auto !important;
	}
</style>
<script>
	export default {
		data() {
			return {
				title: '用户列表',
				table_loading: false,
				pageInfo: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},
				formInline: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: '',
					voucherType: '2',
					voucherName: '',
					voucherStat: '',
					storeId: ''
				},
				formInline2: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: '',
					voucherType: '1',
					voucherName: '',
					voucherStat: '',
					storeId: ''
				},
				pageInfo2: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},
				formLabelWidth: '120px',
				loading: false,
				dialogVisible: false,
				activeName: '1',
				sortList: [],
				secondList: [],
				showSort: false,
				storeId: '',
				statList: [{
					text: '商家禁用',
					value: '0'
				}, {
					text: '已启用',
					value: '1'
				}, {
					text: '平台禁用',
					value: '2'
				}],
				vipCardList: [{
						text: '已下架',
						value: '0'
					},
					{
						text: '出售中',
						value: '1'
					},
					{
						text: '已失效',
						value: '2'
					}
				],
				dialogFindVipVisible: false,
				dialogVisibleAll: false,
				dialogVisiblePayHistory: false,
				formInlineCard: {},
				proportion: [{
						text: '2%',
						value: 0.02
					}, {
						text: '4%',
						value: 0.04
					}, {
						text: '6%',
						value: 0.06
					},
					{
						text: '8%',
						value: 0.08
					}
				],
				activeCardName: '1',
				endDaTE: '长期有效',
				tableCard_loading: false,
				formInline5: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: ''
				},
				pageInfo5: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},
				formInline4: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					voucherType: '3',
					desc: 'DESC',
					pageSize: 10,
					type: '3',
					storeId: ''
				},
				pageInfo4: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},
				formInlinePay: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: '',
					voucherType: '3',
					voucherName: '',
					voucherStat: '',
					storeId: ''
				},
				pageInfoPay: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},

			}
		},
		created() {
			this.formInline.storeId = this.$route.params.id
			this.formInline2.storeId = this.$route.params.id
			this.formInline4.storeId = this.$route.params.id
			this.formInline5.storeId = this.$route.params.id
			this.formInlinePay.storeId = this.$route.params.id
			this.storeId = this.$route.params.id
			this.selectSort()
			this.fetchData(this.pageInfo.pageNum);
		},
		activated() {

		},
		methods: {
			fetchDataPay(page = 1) {
				this.table_loading = true;
				this.pageInfoPay.pageNum = page
				this.formInlinePay.pageNum = this.pageInfoPay.pageNum
				this.dataApi.ajax('selectPagePayStoreVoucher', this.formInlinePay, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfoPay = res
						console.log(res)
					}
				});
			
			},
			handleCurrentChangePay(val) {
				this.fetchDataPay(val)
			},
			fetchData(page = 1) {
				this.table_loading = true;
				this.pageInfo.pageNum = page
				this.formInline.pageNum = this.pageInfo.pageNum
				this.dataApi.ajax('selectPagePayStoreVoucher', this.formInline, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfo = res
					}
				});

			},
			fetchData2(page = 1) {
				this.table_loading = true;
				this.pageInfo2.pageNum = page
				this.formInline2.pageNum = this.pageInfo2.pageNum
				this.dataApi.ajax('selectPagePayStoreVoucher', this.formInline2, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfo2 = res
					}
				});

			},
			changeType() {
				this.formInline.phone = ''
				this.formInline.realName = ''
			},
			handleCurrentChange(val) {

				if (this.activeName == '1') {
					this.fetchData(val)
				}
				if (this.activeName == '2') {
					this.fetchData2(val)
				}
			},
			goodDetail(id) {
				this.$router.push('/merchant/goods_detail/' + id)
			},
			voucherDetail(id) {
				this.$router.push('/merchant/voucher_detail/' + id)
			},
			order(column) {
				if (!column.order) {
					return;
				}
				if (column.order == 'ascending') {
					this.formInline.desc = 'ASC'
				} else {
					this.formInline.desc = 'DESC'
				}
				this.formInline.sort = column.prop.toUpperCase()
				this.fetchData(this.pageInfo.pageNum)
			},
			order2(column) {
				if (!column.order) {
					return;
				}
				if (column.order == 'ascending') {
					this.formInline2.desc = 'ASC'
				} else {
					this.formInline2.desc = 'DESC'
				}
				this.formInline2.sort = column.prop.toUpperCase()
				this.fetchData2(this.pageInfo2.pageNum)
			},
			check(item) {
				this.$router.push('/manor/manor_deal/' + item.cityCode + '?cityName=' + item.cityName)
			},
			handleClick(tab, event) {
				if (this.activeName == '1') {
					this.fetchData(1)
				}
				if (this.activeName == '2') {
					this.fetchData2(1)
				}
				if (this.activeName == '3') {
					this.fetchData4(1)
				}
			},
			selectSort() {
				this.dataApi.ajax('selectGoodCate', {
					cateState: '1',
					storeId: this.storeId
				}, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.sortList = res.dtos
					}
				});

			},
			selectSort2() {
				this.formInline.goodTwoCate = ''
				this.dataApi.ajax('selectGoodCate', {
					cateId: this.formInline.goodOneCate,
					cateState: '1',
					storeId: this.storeId
				}, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.secondList = res.dtos
					}
				});

			},
			handleDelete(item, type) {
				var state = ''
				state = item.voucherStat == 1 ? 2 : 1
				this.$confirm('确认' + type + '?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.dataApi.ajax('editPayStoreVoucher', {
						voucherStat: state,
						voucherId: item.voucherId
					}, res => {
						if (res.responseType === 'S') {
							this.$message({
								type: 'success',
								message: type + '成功!'
							});
							this.fetchData(this.pageInfo.pageNum)
						}
					});
				}).catch(() => {

				});
			},
			handleDelete2(item, type) {
				var state = ''
				state = item.voucherStat == 1 ? 2 : 1
				this.$confirm('确认' + type + '?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.dataApi.ajax('editPayStoreVoucher', {
						voucherStat: state,
						voucherId: item.voucherId
					}, res => {
						if (res.responseType === 'S') {
							this.$message({
								type: 'success',
								message: type + '成功!'
							});
							this.fetchData2(this.pageInfo2.pageNum)
						}
					});
				}).catch(() => {

				});
			},
			// 会员卡列表
			fetchData4(page = 1) {
				this.table_loading = true;
				this.pageInfo4.pageNum = page
				this.formInline4.pageNum = this.pageInfo4.pageNum
				this.dataApi.ajax('selectStoreCardByPage', this.formInline4, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfo4 = res
					}
				});
			},
			showCardDiog(data) {
				this.dialogFindVipVisible = true
				this.formInlineCard = JSON.parse(JSON.stringify(data))
				if (this.formInlineCard.voucherCover != '') {
					let formInlineCardstr = this.formInlineCard.voucherCover
					let formInlineCardarr = formInlineCardstr.split(',')
					this.formInlineCard.voucherCover = formInlineCardarr
				} else {
					this.formInlineCard.voucherCover = []
				}
				if (this.formInlineCard.logo != '') {
					let logostr = this.formInlineCard.logo
					let logoarr = logostr.split(',')
					this.formInlineCard.logo = logoarr
				} else {
					this.formInlineCard.logo = []
				}
			},
			cardSubmit() {
				if (this.formInlineCard.voucherCover.length < 1) {
					this.showMsg('请上传卡片封面', 'warning')
					return false;
				}
				let data = JSON.parse(JSON.stringify(this.formInlineCard))
				var arr2 = data.voucherCover
				var str2 = arr2.join(',');
				data.voucherCover = str2
				var arr3 = data.logo
				var str3 = arr3.join(',');
				data.logo = str3
				this.dataApi.ajax('editPayStoreCard', this.formInlineCard, res => {
					if (res.responseType === 'S') {
						this.$message({
							type: 'success',
							message: '编辑成功!'
						});
						this.dialogFindVipVisible = false
					}
				});
			},
			uploading4(f) {
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading5(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			handleClose() {
				this.dialogFindVipVisible = false
				this.dialogVisibleAll = false
				this.dialogVisiblePayHistory = false
			},
			// 会员卡名单
			findCardList() {
				this.fetchData5(1)
			},
			fetchData5(page = 1) {
				this.tableCard_loading = true;
				this.pageInfo5.pageNum = page
				this.formInline5.pageNum = this.pageInfo5.pageNum
				this.dataApi.ajax('storeCardUserList', this.formInline5, res => {
					this.tableCard_loading = false;
					console.log(res)
					if (res.responseType === 'S') {
						this.pageInfo5 = res
						this.dialogVisibleAll = true
					}
				});

			},
			handleCurrentChangeCard(val) {
				this.fetchData5(val)
			},
			handleDelete3(item, type) {
				var state = ''
				state = item.voucherStat == 1 ? 2 : 1
				this.$confirm('确认' + type + '?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.dataApi.ajax('editPayStoreCard', {
						voucherStat: state,
						voucherId: item.voucherId
					}, res => {
						if (res.responseType === 'S') {
							this.$message({
								type: 'success',
								message: type + '成功!'
							});
							this.fetchData4(this.pageInfo4.pageNum)
						}
					});
				}).catch(() => {

				});
			},
			findPayCardList() {
				this.fetchDataPay(1)
				this.dialogVisiblePayHistory = true
				console.log('会员卡购买记录')
			}
		}
	}
</script>
